<template>
	<view class="briefIntroduction">
		<view class="title">{{ data.name }}</view>

		<view class="line">
			<view class="subtitle">{{ data.desc }}</view>
		</view>
		<view class="line">
			<view class="unit">￥</view>
			<view class="price">
				{{ price }}
			</view>
		</view>
		<view class="opt">
			<view class="optItem right" @click="share">
				<image class="icon" src="/static/images/share.png" mode=""></image>
				<view class="txt">分享</view>
			</view>
			<view class="optItem right" @click="FavoriteEdit">
				<image class="icon" v-show="!data.is_favorite || data.is_favorite === 0" src="/static/images/collection.png" mode=""></image>
				<image class="icon" v-show="data.is_favorite == 1" src="/static/images/collectionAct.png" mode=""></image>
				<view class="txt">收藏</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { timeStrGetDate, timeStrGetTime } from '@/utils/utils.js';
	export default {
		name: 'briefIntroduction',
		props: {
			data: {
				type: Object,
				default: () => {},
			},
			type: {
				type: String,
				default: '2',
			},
			price: {
				type: String,
				default: '0.00',
			},
		},
		data() {
			return {};
		},
		methods: {
			timeStrGetDate: timeStrGetDate,
			timeStrGetTime: timeStrGetTime,
			share() {
				uni.setStorageSync('wbzDetails', this.data);
				const url = '/pages/wbz/details/details?id=' + this.data.id;
				uni.navigateTo({
					url: '/pages/wbz/share/share?page=' + url,
				});
			},
			async FavoriteEdit() {
				const res = await this.$api.FavoriteEdit({ type: this.type, id: this.data.id });
				this.$emit('FavoriteEdit');
			},
		},
	};
</script>

<style lang="scss" scoped>
	.briefIntroduction {
		position: relative;
		background: $content-bg-colcor;
		width: 100%;
		height: auto;
		overflow: hidden;
		padding-bottom: 30rpx;
		.title {
			margin: 30rpx;
			margin-bottom: 15rpx;
			color: #000000;
			font-size: $uni-font-size-17;
		}
		.line {
			margin-top: 15rpx;
			margin-left: 30rpx;
			align-items: center;
			display: flex;
			.icon {
				height: 25rpx;
				margin-right: 15rpx;
			}
			.subtitle {
				color: #999999;
				font-size: $uni-font-size-12;
			}
			.unit {
				font-size: $uni-font-size-12;
				color: $price-color;
			}
			.price {
				font-weight: bold;
				font-size: $uni-font-size-17;
				color: $price-color;
			}
		}
		.opt {
			overflow: hidden;
			position: absolute;
			right: $margin-width;
			bottom: 20rpx;
			.optItem {
				overflow: hidden;
				color: #999999;
				font-size: $uni-font-size-10;
				text-align: center;
				display: flex;
				flex-direction: column;
				align-items: center;
				margin-right: $margin-width;
				.icon {
					width: 30rpx;
					height: 30rpx;
					margin-bottom: 10rpx;
				}
			}
		}
	}
</style>